import { Modal, Form, Input } from 'antd';
import React,{useState} from 'react';
import { connect } from 'umi';

const EditForm = (props: any) => {
  const { showEdit,dispatch } = props;
  const [form]=Form.useForm();
  const onFinish = () => {
      form.validateFields().then((values)=>{
        console.log(values);

      })
  };

  const handleCancel = () => {
    dispatch({
        type:'FilmCategory/save',
        payload:{
            showEdit:false,
        }
    })
  };
  return (
    <Modal visible={showEdit} title="编辑" onCancel={handleCancel} onOk={onFinish}>
      <Form onFinish={onFinish} form={form}>
        <Form.Item label="名字" name="name" rules={[{ required: true, message: '请输入名字' }]}>
          <Input placeholder="请输入名字" />
        </Form.Item>
        <Form.Item label="简介" name="desc" rules={[{ required: true, message: '请输入简介' }]}>
          <Input.TextArea placeholder="请输入简介" />
        </Form.Item>

      </Form>
    </Modal>
  );
};
const mapStateToProps = (state: any) => ({
  model: state.FilmCategory.current,
  showEdit: state.FilmCategory.showEdit,
  isEdit: state.FilmCategory.isEdit,
});
export default connect(mapStateToProps)(EditForm);
